<template>
  <div style="padding-top: 20px">
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="企业名称" prop="deptName">
            <el-input v-model="form.name" placeholder="请输入部门名称" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="负责人" prop="leader">
            <el-input
              v-model="form.principalName"
              placeholder="请输入负责人"
              maxlength="20"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="联系电话" prop="phone">
            <el-input
              v-model="form.principalTel"
              placeholder="请输入联系电话"
              maxlength="11"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <!-- <el-row>
        <el-col :span="12">
          <el-form-item label="邮箱" prop="email">
            <el-input
              v-model="form.email"
              placeholder="请输入邮箱"
              maxlength="50"
            />
          </el-form-item>
        </el-col>
      </el-row> -->
      <el-row>
        <el-col :span="12">
          <el-form-item label="员工数量" prop="email">
            <el-input
              v-model="form.useEmployeeNum"
              placeholder="请输入邮箱"
              maxlength="50"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="企业地址" prop="email">
            <el-input
              v-model="form.detailAddress"
              placeholder="请输入邮箱"
              maxlength="50"
            />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div style="width: 750px; text-align: center">
      <el-button type="primary" @click="handleQuery">提 交</el-button>
    </div>
  </div>
</template>
  
  <script>
import draggable from "vuedraggable";
import uploadView from "../../../components/ImageUpload";
import { addpreson } from "@/api/addming";
export default {
  components: {
    draggable,
    uploadView,
  },
  data() {
    return {
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        // email: [
        //   {
        //     type: "email",
        //     message: "请输入正确的邮箱地址",
        //     trigger: ["blur", "change"],
        //   },
        // ],
        phone: [
          {
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur",
          },
        ],
      },
    };
  },
  methods: {
    // 提交
    handleQuery() {
      addpreson(this.form).then((res) => {
        console.log("保存成功了吗", res);
        if(res.code == 200){
          this.$modal.msgSuccess("新增成功");
          this.form = {}
        }
      });
    },
  },
};
</script>
  
  <style>
</style>
  